#include<iostream>
using namespace std;
const int N = 1e3 + 10;
int a[N];
int n, m;
int ans;
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++)cin >> a[i];
	int sum = 0;
	for (int i = 1; i <= n; i++) {
		sum += a[i];
		if (sum > m) {
			ans++;
			sum = a[i];
		}
	}
	cout << ans << endl;
	return 0;
}